package tgc.edu.demo.jkxt.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import tgc.edu.demo.jkxt.custom.BaseRepository;
import tgc.edu.demo.jkxt.entity.Course;
import tgc.edu.demo.jkxt.entity.Grade;

@Repository
public interface GradeRepository extends BaseRepository<Grade, Integer>{
	
	public List<Grade> findByStudentId(Integer id);

	@Query("select distinct t.course from Grade t where t.student.tbClass.id=?1")
	public List<Course> findCourseByTbClassId(Integer bjId);

	
	
	
	public Grade findByStudentIdAndCourseId(Integer id, Integer kcId);

	@Query(value="SELECT * FROM grade WHERE student_id=?2 AND shijuan_id=?1",nativeQuery = true)
	public Grade findByShijuanIdAndStudentId(Integer shijuanId, Integer studentId);
	
}
